//
//  SecondView.m
//  YDD
//
//  Created by 欧洪飞 on 2017/8/22.
//  Copyright © 2017年 jy. All rights reserved.
//

#import "SecondView.h"
#import "SelectHouseTypeView.h"

@implementation SecondView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)layoutSubviews{
    UITapGestureRecognizer *payGest = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(payEvent)];
    [self.payLabel addGestureRecognizer:payGest];
    
    UITapGestureRecognizer *tingGest = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tingEvent)];
    [self.tingLabel addGestureRecognizer:tingGest];
    
    UITapGestureRecognizer *zhuGest = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(zhuEvent)];
    [self.zuTypeLabel addGestureRecognizer:zhuGest];
}

- (void)payEvent{
    NSMutableArray *dataArray = [[NSMutableArray alloc]initWithObjects:@"押一付一",@"押一付三",@"半年",@"年付", nil];
    SelectHouseTypeView *pay = [[SelectHouseTypeView alloc]init];
    [pay showSelectTitle:@"付款方式" dataArray:dataArray count:1];
    pay.typePickSelect = ^(NSString *date) {
        [self.payLabel setText:date];
    };
}

- (void)tingEvent{
    
    NSMutableArray *dataArray = [[NSMutableArray alloc]init];
    NSMutableArray *tingArr = [[NSMutableArray alloc]init];
    NSMutableArray *shiArr = [[NSMutableArray alloc]init];
    NSMutableArray *weiArr = [[NSMutableArray alloc]init];
    for (int i = 0; i < 10; i ++) {
        if (i == 0) {
            [shiArr addObject:[NSString stringWithFormat:@"%zd厅",i]];
            [weiArr addObject:[NSString stringWithFormat:@"%zd卫",i]];
        }else{
            [tingArr addObject:[NSString stringWithFormat:@"%zd室",i]];
            [shiArr addObject:[NSString stringWithFormat:@"%zd厅",i]];
            [weiArr addObject:[NSString stringWithFormat:@"%zd卫",i]];
        }
        
        
    }
    [dataArray addObject:tingArr];
    [dataArray addObject:shiArr];
    [dataArray addObject:weiArr];
    
    SelectHouseTypeView *pay = [[SelectHouseTypeView alloc]init];
    [pay showSelectTitle:@"厅室" dataArray:dataArray count:3];
    pay.typePickSelect = ^(NSString *date) {
        [self.tingLabel setText:date];
    };
}

- (void)zhuEvent{
    NSMutableArray *dataArray = [[NSMutableArray alloc]initWithObjects:@"整租",@"合租", nil];
    SelectHouseTypeView *pay = [[SelectHouseTypeView alloc]init];
    [pay showSelectTitle:@"租住方式" dataArray:dataArray count:1];
    pay.typePickSelect = ^(NSString *date) {
        [self.zuTypeLabel setText:date];
    };
}


@end
